.class public Llt/noframe/gpsfarmguide/MapScrolling;
.super Ljava/lang/Object;
.source "MapScrolling.java"


# instance fields
.field private ctx:Landroid/content/Context;

.field private dragging:Z

.field private offset_x:I

.field private offset_y:I


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 1

    .line 25
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, 0x0

    .line 13
    iput v0, p0, Llt/noframe/gpsfarmguide/MapScrolling;->offset_x:I

    .line 14
    iput v0, p0, Llt/noframe/gpsfarmguide/MapScrolling;->offset_y:I

    .line 15
    iput-boolean v0, p0, Llt/noframe/gpsfarmguide/MapScrolling;->dragging:Z

    .line 26
    iput-object p1, p0, Llt/noframe/gpsfarmguide/MapScrolling;->ctx:Landroid/content/Context;

    return-void
.end method


# virtual methods
.method public down(Landroid/view/MotionEvent;)V
    .locals 2

    .line 34
    new-instance v0, Landroid/graphics/Point;

    invoke-virtual {p1}, Landroid/view/MotionEvent;->getX()F

    move-result v1

    float-to-int v1, v1

    invoke-virtual {p1}, Landroid/view/MotionEvent;->getY()F

    move-result p1

    float-to-int p1, p1

    invoke-direct {v0, v1, p1}, Landroid/graphics/Point;-><init>(II)V

    .line 36
    iget p1, v0, Landroid/graphics/Point;->x:I

    iput p1, p0, Llt/noframe/gpsfarmguide/MapScrolling;->offset_x:I

    .line 37
    iget p1, v0, Landroid/graphics/Point;->y:I

    iput p1, p0, Llt/noframe/gpsfarmguide/MapScrolling;->offset_y:I

    const/4 p1, 0x1

    .line 38
    iput-boolean p1, p0, Llt/noframe/gpsfarmguide/MapScrolling;->dragging:Z

    return-void
.end method

.method public move(Landroid/view/MotionEvent;)V
    .locals 0

    return-void
.end method

.method public up(Landroid/view/MotionEvent;)V
    .locals 7

    .line 56
    iget-boolean v0, p0, Llt/noframe/gpsfarmguide/MapScrolling;->dragging:Z

    if-eqz v0, :cond_2

    .line 57
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getX()F

    move-result v0

    iget v1, p0, Llt/noframe/gpsfarmguide/MapScrolling;->offset_x:I

    int-to-float v1, v1

    sub-float/2addr v0, v1

    float-to-double v0, v0

    const-wide/high16 v2, 0x4000000000000000L    # 2.0

    invoke-static {v0, v1, v2, v3}, Ljava/lang/Math;->pow(DD)D

    move-result-wide v0

    invoke-virtual {p1}, Landroid/view/MotionEvent;->getY()F

    move-result p1

    iget v4, p0, Llt/noframe/gpsfarmguide/MapScrolling;->offset_y:I

    int-to-float v4, v4

    sub-float/2addr p1, v4

    float-to-double v4, p1

    invoke-static {v4, v5, v2, v3}, Ljava/lang/Math;->pow(DD)D

    move-result-wide v2

    add-double/2addr v0, v2

    invoke-static {v0, v1}, Ljava/lang/Math;->sqrt(D)D

    move-result-wide v0

    .line 58
    iget-object p1, p0, Llt/noframe/gpsfarmguide/MapScrolling;->ctx:Landroid/content/Context;

    const-wide/high16 v2, 0x4044000000000000L    # 40.0

    invoke-static {v2, v3, p1}, Llt/noframe/gpsfarmguide/utils/ScreenHelper;->dpToPx(DLandroid/content/Context;)I

    move-result p1

    int-to-double v4, p1

    const/4 p1, 0x0

    cmpg-double v6, v0, v4

    if-gez v6, :cond_0

    .line 59
    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object v4

    invoke-virtual {v4}, Llt/noframe/gpsfarmguide/Data;->isFolowing()Z

    move-result v4

    if-eqz v4, :cond_1

    iget-object v4, p0, Llt/noframe/gpsfarmguide/MapScrolling;->ctx:Landroid/content/Context;

    invoke-static {v2, v3, v4}, Llt/noframe/gpsfarmguide/utils/ScreenHelper;->dpToPx(DLandroid/content/Context;)I

    move-result v2

    div-int/lit8 v2, v2, 0x3

    int-to-double v2, v2

    cmpl-double v4, v0, v2

    if-lez v4, :cond_1

    .line 60
    iget-object v0, p0, Llt/noframe/gpsfarmguide/MapScrolling;->ctx:Landroid/content/Context;

    invoke-static {v0, p1, p1, p1}, Llt/noframe/gpsfarmguide/LocationTracking;->centerMyPosition(Landroid/content/Context;ZZZ)Z

    goto :goto_0

    .line 62
    :cond_0
    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object v0

    invoke-virtual {v0}, Llt/noframe/gpsfarmguide/Data;->isFolowing()Z

    move-result v0

    if-eqz v0, :cond_1

    .line 63
    iget-object v0, p0, Llt/noframe/gpsfarmguide/MapScrolling;->ctx:Landroid/content/Context;

    invoke-static {v0}, Llt/noframe/gpsfarmguide/LocationTracking;->setMapNotFollowing(Landroid/content/Context;)V

    .line 65
    :cond_1
    :goto_0
    iput-boolean p1, p0, Llt/noframe/gpsfarmguide/MapScrolling;->dragging:Z

    :cond_2
    return-void
.end method
